import request from "@/utils/request";
import store from "@/store/index";
export function isTenant() {
  return !!store.getters.userInfo.tenantId;
}
function deviceContext() {
  return isTenant() ? "/device" : "/ttdevice";
}
/*
预置点、巡航计划、看守位、录像计划 原device迁移至video - video
*/
function videoContext() {
  return isTenant() ? "/video-video" : "/ttdevice";
}
const video = "/video-video";
// 开始巡航 结束巡航
export function doPatrol(data) {
  return request({
    url: video + "/video/patrol/doPatrol",
    method: "post",
    data,
  });
}

// 新增巡航计划
export function addCruisePatrol(data) {
  return request({
    url: video + "/video/patrol/addCruisePatrol",
    method: "post",
    data,
  });
}

// 修改巡航计划
export function updatePatrol(data) {
  return request({
    url: videoContext() + "/video/patrol/updatePatrol",
    method: "post",
    data,
  });
}

// 删除巡航计划
export function delPatrol(data) {
  return request({
    url: videoContext() + "/video/patrol/delPatrol",
    method: "post",
    data,
  });
}

// 查询巡航计划
export function queryPatrol(data) {
  return request({
    url: videoContext() + "/video/patrol/queryPatrol",
    method: "post",
    data,
  });
}

// 查询预置位
export function queryPresetList(data) {
  return request({
    url: deviceContext() + "/video/patrol/queryPresetList",
    method: "post",
    data,
  });
}
